package xuli.dao.impl;

import entity.Brand_Info;
import entity.Product_Info;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import util.C3P0Util;
import xuli.dao.BrandDao;

import java.sql.SQLException;

public class BrandDaoImpl implements BrandDao {
    private QueryRunner queryRunner = new QueryRunner(C3P0Util.getDataSource());


    @Override
    public Brand_Info findById(Integer brandID) {
        String sql = "select * from brand_info where brand_id=?";
        Brand_Info productInfo = null;
        try {
            productInfo = queryRunner.query(sql, new BeanHandler<>(Brand_Info.class), brandID);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return productInfo;
    }
}
